const state = {
    roles: [],
    page: {},
    privileges: [] //权限列表
}
const actions = {
    saveRole: ({ commit }, payload) => {
        commit('SAVEROLE', payload)
    },
    privilege_list: ({ commit }, payload) => {
        commit('PRIVILEGE', payload)
    }
}
const mutations = {
    SAVEROLE: (state, payload) => {
        state.roles = payload.result
        state.page = {
            size: 10,
            number: payload.number || 1,
            total: payload.resultNum
        }
    },
    PRIVILEGE: (state, payload) => {
        state.privileges = payload.result
    }
}
const getters = {
    getRoles: state => state.roles
}

export default {
    state,
    mutations,
    actions,
    getters
}